<script setup>
import { ref, reactive } from "vue";
// reactive 对象可以用reactive来生命     react
// 不可以更改地址
let user = reactive({
  name: "zhagnsan",
  age: 20,
  money: 20000,
});
let n = ref(10);
const changeUser = () => {
  user.age = 21;
  user.money = 21000;

  n.value += 1;
  //   user = {
  //     ...user,
  //     age: 21,
  //     money: 21000,
  //   };
};
</script>
<template>
  <div>
    <p>姓名 {{ user.name }} -- {{ n }}</p>
    <p>年龄 {{ user.age }}</p>
    <p>工资 {{ user.money }}</p>

    <button @click="changeUser">修改了</button>
  </div>
</template>

<style lang="scss" scoped></style>
